#include "EventLoop.h"

EventLoop::EventLoop()
    : ep_(new Epoll)
{
}
EventLoop::~EventLoop()
{
    delete ep_;
}

Epoll* EventLoop::ep()
{
    return ep_;
}

void EventLoop::run()
{
    while (1)
    {
        std::vector<Channel*> channels;
        channels = ep_->loop();

        for (auto ch : channels)
        {
            ch->handleevent();
        }
    }
}